import { S } from '../../s';
import { IPSAppCounterRef } from '../control/ipsapp-counter-ref';
import { IPSAppIndexView } from './ipsapp-index-view';
import { IPSAppView } from './ipsapp-view';
import { PSAppViewImpl } from './psapp-view-impl';
import { IPSSysImage } from '../../res/ipssys-image';

export class PSAppIndexViewImpl
  extends PSAppViewImpl
  implements IPSAppIndexView
{
  get appIconPath(): string {
    return this.M.appIconPath;
  }

  get appIconPath2(): string {
    return this.M.appIconPath2;
  }

  get appSwitchMode(): 0 | 1 {
    return this.M.appSwitchMode;
  }

  get bottomInfo(): string {
    return this.M.bottomInfo;
  }

  get caption(): string {
    return this.M.caption;
  }

  protected defpsappview: IPSAppView;
  getDefPSAppView(): IPSAppView | null {
    return (
      this.defpsappview ||
      (this.defpsappview = this.fillObjectModel(
        S._1e,
        this.M.getDefPSAppView,
        S._37b,
      ) as IPSAppView)
    );
  }

  get headerInfo(): string {
    return this.M.headerInfo;
  }

  get mainMenuAlign():
    | 'LEFT'
    | 'TOP'
    | 'CENTER'
    | 'TREEEXP'
    | 'TABEXP_TOP'
    | 'TABEXP_LEFT'
    | 'TABEXP_BOTTOM'
    | 'TABEXP_RIGHT'
    | 'NONE' {
    return this.M.mainMenuAlign;
  }

  protected pssysimage: IPSSysImage;
  getPSSysImage(): IPSSysImage | null {
    return (
      this.pssysimage ||
      (this.pssysimage = this.fillObjectModel(
        S._27b,
        this.M.getPSSysImage,
        S._2ad,
      ) as IPSSysImage)
    );
  }

  protected portalpsappcounterref: IPSAppCounterRef;
  getPortalPSAppCounterRef(): IPSAppCounterRef | null {
    return (
      this.portalpsappcounterref ||
      (this.portalpsappcounterref = this.fillObjectModel(
        S._9d,
        this.M.getPortalPSAppCounterRef,
        S._2d6,
      ) as IPSAppCounterRef)
    );
  }

  get subCaption(): string {
    return this.M.subCaption;
  }

  get title(): string {
    return this.M.title;
  }

  get blankMode(): boolean {
    return this.M.blankMode;
  }

  get defaultPage(): boolean {
    return this.M.defaultPage != null ? this.M.defaultPage : false;
  }

  get enableAppSwitch(): boolean {
    return this.M.enableAppSwitch;
  }

  get enableDP(): boolean {
    return this.M.enableDP;
  }

  get enableWF(): boolean {
    return this.M.enableWF != null ? this.M.enableWF : false;
  }
  get cls(): string {
    return 'PSAppIndexViewImpl';
  }
  instanceof(cls: string): boolean {
    if (cls == S._7c) return true;
    return super.instanceof(cls);
  }
}
